package com.oauth.yahoo.server.beans;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Text;
import com.oauth.service.generic.beans.OAuthServiceBean;
import com.oauth.service.generic.constants.OAuthTokenState;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class YahooServiceBean implements OAuthServiceBean {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long key;

	@Persistent
	private Long memberId;

	@Persistent
	private String yahooId;

	@Persistent
	private Text accessToken;

	@Persistent
	private String accessTokenSecret;

	@Persistent
	private int state;

	public YahooServiceBean() {
		super();
	}

	public YahooServiceBean(Long pMemberId, String pToken, String pTokenSecret, String pTwitterId) {
		super();
		memberId = pMemberId;
		accessToken = new Text(pToken);
		accessTokenSecret = pTokenSecret;
		yahooId = pTwitterId;
	}

	/**
	 * @return the key
	 */
	public Long getKey() {
		return key;
	}

	/**
	 * @param pKey
	 *            the key to set
	 */
	public void setKey(Long pKey) {
		key = pKey;
	}

	/**
	 * @return the yahooId
	 */
	public String getYahooId() {
		return yahooId;
	}

	/**
	 * @param pYahooId
	 *            the yahooId to set
	 */
	public void setYahooId(String pYahooId) {
		yahooId = pYahooId;
	}

	/**
	 * @return the state
	 */
	public OAuthTokenState getState() {
		return OAuthTokenState.getState(state);
	}

	/**
	 * @param pState
	 *            the state to set
	 */
	public void setState(OAuthTokenState pState) {
		state = pState.getState();
	}

	/**
	 * @return the memberId
	 */
	public Long getMemberId() {
		return memberId;
	}

	/**
	 * @param pMemberId
	 *            the memberId to set
	 */
	public void setMemberId(Long pMemberId) {
		memberId = pMemberId;
	}

	/**
	 * @return the accessToken
	 */
	public String getAccessToken() {
		return accessToken.getValue();
	}

	/**
	 * @param pAccessToken
	 *            the accessToken to set
	 */
	public void setAccessToken(String pAccessToken) {
		accessToken = new Text(pAccessToken);
	}

	/**
	 * @return the accessTokenSecret
	 */
	public String getAccessTokenSecret() {
		return accessTokenSecret;
	}

	/**
	 * @param pAccessTokenSecret
	 *            the accessTokenSecret to set
	 */
	public void setAccessTokenSecret(String pAccessTokenSecret) {
		accessTokenSecret = pAccessTokenSecret;
	}

	@Override
	public Date getCreationDate() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Date getLastUpdateDate() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setCreationDate(Date pArg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void setLastUpdateDate(Date pArg0) {
		// TODO Auto-generated method stub

	}

}
